home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Trazados, regiones y recorte / KeyholeClip / KeyholeClip.cs next >
Encoding:
Text File  |  2002-05-07  |  991 b   |  35 lines

  1. //------------------------------------------
  2. // KeyholeClip.cs ⌐ 2001 by Charles Petzold
  3. //------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class KeyholeClip: PrintableForm
  10. {
  11.      protected Image        image;
  12.      protected GraphicsPath path;
  13.  
  14.      public new static void Main()
  15.      {
  16.           Application.Run(new KeyholeClip());
  17.      }
  18.      public KeyholeClip()
  19.      {
  20.           Text = "Recorte ojo de cerradura";
  21.           
  22.           image = Image.FromFile(
  23.                "..\\..\\..\\..\\Images and Bitmaps\\Apollo11FullColor.jpg");
  24.  
  25.           path = new GraphicsPath();
  26.           path.AddArc(80, 0, 80, 80, 45, -270);
  27.           path.AddLine(70, 180, 170, 180);
  28.      }
  29.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  30.      {
  31.           grfx.SetClip(path);
  32.           grfx.DrawImage(image, 0, 0, image.Width, image.Height);
  33.      }
  34. }
  35.